package com.dao.impl;

import com.dao.OrderDao;
import com.pojo.Order;
import com.pojo.OrderItem;

import java.util.List;

public class OrderDaoImpl extends BaseDao implements OrderDao {
    @Override
    public int saveOrder(Order order) {

        String sql = "insert into t_order(`order_id`,`create_time`,`price`,`status`,`user_id`) values(?,?,?,?,?)";
        return update(sql,order.getOrder_id(),order.getCreateTime(),order.getPrice(),order.getStatus(),order.getUserId());
    }

    @Override
    public List<Order> queryMyOrders(Integer userid) {
        String sql = "SELECT `order_id`,`create_time`,`price`,`status`,`user_id` FROM t_order WHERE `user_id`=?";
        return queryForList(Order.class,sql,userid);
    }


}
